﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SelfMadeMillionaire.Core.Entities;
using SelfMadeMillionaire.Core.Repositories;

namespace SelfMadeMillionaire.DAL.Repositories
{
    public class EmailSendRepository : Repository<EmailSend>, IEmailSendRepository
    {
        public EmailSendRepository(IUnitOfWork uow) : base(uow)
        {
            
        }

        public override EmailSend Update(EmailSend entity)
        {
            var dbEntity = Get(entity.ID);

            dbEntity.AdditRecipients = entity.AdditRecipients;
            dbEntity.Subject = entity.Subject;
            dbEntity.Body = entity.Body;
            dbEntity.IsFreeSubscribers = entity.IsFreeSubscribers;
            dbEntity.IsSilver = entity.IsSilver;
            dbEntity.IsGold = entity.IsGold;
            dbEntity.IsPlatinum = entity.IsPlatinum;
            dbEntity.Status = entity.Status;
            dbEntity.CreationDate = entity.CreationDate;
            dbEntity.SentDate = entity.SentDate;
            
            Commit();

            return dbEntity;
        }
    }
}
